import { Navigate } from "react-router-dom";
import Login from "@/pages/Login";
import Content from "@/pages/Content";
import UserList from "@/pages/User/list";
import UserSet from "@/pages/User/setting";
import BookList from "@/pages/Book/list";
import BookSet from "@/pages/Book/setting";
import Error404 from "@/pages/Error/404";
import Error403 from "@/pages/Error/403";
import Home from "@/pages/Home";
import Other from "@/pages/Other/other";
import { RouteType } from "@/types/route";

export const routes: RouteType[] = [
  {
    path: "/",
    key: "/",
    element: <Navigate to="/login" />,
    label: "默认",
    hidden: true,
  },
  {
    path: "/login",
    key: "login",
    label: "登录",
    element: <Login />,
    hidden: true,
  },
  {
    path: "/content",
    key: "content",
    label: "内容管理",
    element: <Content />,
    hidden: false,
    icon: "DashboardOutlined", // 更新图标
    children: [
      {
        path: "home",
        key: "home",
        label: "首页",
        element: <Home />,
        hidden: false,
        icon: "HomeOutlined",
      },
      {
        path: "user",
        key: "user",
        label: "用户管理",
        icon: "TeamOutlined",
        children: [
          {
            path: "list",
            key: "user/list",
            label: "用户列表",
            element: <UserList />,
            hidden: false,
          },
          {
            path: "setting",
            key: "user/setting",
            label: "用户设置",
            element: <UserSet />,
            hidden: false,
          },
        ],
      },
      {
        path: "book",
        key: "book",
        label: "图书管理",
        icon: "BookOutlined", // 更新图标
        children: [
          {
            path: "list",
            key: "book/list",
            label: "图书列表",
            element: <BookList />,
            hidden: false,
          },
          {
            path: "setting",
            key: "book/setting",
            label: "图书设置",
            element: <BookSet />,
            hidden: false,
          },
        ],
      },
      {
        path: "other",
        key: "other",
        label: "其他",
        icon: "BarsOutlined",
        element: <Other />,
        hidden: false,
      },
    ],
  },
  {
    path: "*",
    key: "404",
    label: "404",
    element: <Error404 />,
    hidden: true,
  },
];
